'use strict';

module.exports = app => {
    const { Sequelize, model } = app

    const Model = model.define('minaOrderAudit', {
        id:{
            type: Sequelize.STRING.BINARY,
            defaultValue: Sequelize.UUIDV1,
            primaryKey: true
        },
        auditor: {
            type: Sequelize.STRING(20),
        },
        remark: {
            type: Sequelize.STRING(20),
        },
        status: {
            type: Sequelize.INTEGER(8),
            defaultValue: 0,
            allowNull: false,
        },
    }, {
        freezeTableName: true,
        tableName: 'mina_order_audit',
        timestamps: true,
        paranoid: true,
    })

    Model.associate = function() {
        model.MinaOrderAudit.belongsTo(model.MinaOrder)
        model.MinaOrder.hasOne(model.MinaOrderAudit)
    }

    return Model
}